package com.bootdo.app.controller;

import com.bootdo.app.common.annotion.IgnoreUserToken;
import com.bootdo.app.common.msg.Response;
import com.bootdo.app.dto.miniprogram.UserMeetingVipDto;
import com.bootdo.app.service.UserMeetingService;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @auther: 作者: Along
 * @description: 用户签到
 */
@RestController
@RequestMapping(value = "/app/user_meeting")
public class UserMeetingController {

    @Autowired
    private UserMeetingService userMeetingService;

    /**
     * 查询签到记录
     */
    @PostMapping(value = "/log")
    public Response meetingLog(){
        return Response.success(userMeetingService.getMeetingLog());
    }

    /**
     * 签到
     */
    @PostMapping(value = "/sign_in")
    public Response addMeeting(){
        userMeetingService.addMeeting();
        return Response.success();
    }

    /**
     * 判断是否可以签到领会员（当月签到满20天）
     * @return true : 可以
     */
    @PostMapping(value = "/is_meet_vip")
    public Response isCanGetMeetingVip(){
        return Response.success(userMeetingService.isCanGetMeetingVip());
    }


    /**
     * 签到领会员
     */
    @PostMapping(value = "/get_vip")
    public Response getMeetingVip(@RequestBody @Valid UserMeetingVipDto userMeetingVipDto){
        userMeetingService.getMeetingVip(userMeetingVipDto);
        return Response.success();
    }

    /**
     * 查询会员商品接口
     */
    @IgnoreUserToken
    @PostMapping(value = "/get_goods_vip")
    public Response getMeetVipGoods(){
        return Response.success(userMeetingService.getMeetVipGoods());
    }

}
